package com.ht.controller;

import java.util.Date;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ht.model.User;
import com.ht.service.UserService;


@Controller
@RequestMapping("/user")
public class UserController {
	@Resource
	private UserService userService;
	
	@RequestMapping("/showUser")
	public String toIndex(HttpServletRequest request,Model model){
//		int userId = Integer.parseInt(request.getParameter("id"));
		User user = this.userService.getUserById(1);
		model.addAttribute("user", user);
		return "showUser";
	}
	
	@Scheduled(cron= "0/2 * * * * ?")
	public void mySpringTask(){
		System.out.println("UserController========================================"+new Date());
	}
}